/**
 * Created by zhu on 2016/2/5.
 */
$(function(){


        initTable();


});

function initTable(){
    $.get(contextPath+"/mmt_admin/examine",function(data){
        data = $.parseJSON(data);
    if(data.status == 0){
        var tbody =  $('#tbody');
        tbody.empty();
        $.each(data.list,function(i,item){
            var temp = '<tr>'+
                '<th scope="row" style="padding-top: 30px;">'+item.username+'</th>'+
                '<td style="padding-top: 30px;" >'+item.shopName+'</td>'+
                ' <td style="padding-top: 30px;">'+item.phone+'</td>'+
                ' <td style="padding-top: 30px;"><button type="button" class="btn btn-info" onclick="pass('+item.id+')">确认通过</button></td>'+
                ' </tr>';
            tbody.append(temp);
        })
    }else{
        alert("请求失败")
    }
    });
}

function pass(id){
    $.get(contextPath+"/mmt_admin/examine/"+id,function(data){
        data = $.parseJSON(data);
        if(data.status == 0){
            initTable();
        }else{
            alert("请求失败");
        }
    })
}
